package com.android.example.storage;

import android.os.Bundle;
import android.widget.GridView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

public class MainActivity5 extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_main5);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });

        RecyclerView recyclerView = findViewById(R.id.recyclerView);//获取了 RecyclerView 的实例
        //LinearLayoutManager layoutManager = new LinearLayoutManager(MainActivity5.this);
        //recyclerView.setLayoutManager(layoutManager);//RecyclerView 中项目的排列方式为线性垂直排列
        int[] imageResources = {R.drawable.jibenyong, R.drawable.jbyf_two, R.drawable.jb};
        RecyclerViewAdapter adapter = new RecyclerViewAdapter(imageResources);
        recyclerView.setAdapter(adapter);//处理 RecyclerView 中每个项目的视图创建、数据绑定等操作

    }
}
